package com.tmc.service.intair;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tmc.bean.common.CommonResult;
import com.tmc.bean.common.ContextInfo;
import com.tmc.bean.common.Pagination;
import com.tmc.bean.common.Report;
import com.tmc.bean.common.TripartiteReport;
import com.tmc.dao.impl.EthClientDaoImpl;
import com.tmc.dao.impl.TripartitePolicyDaoImpl;
import com.tmc.dao.impl.UserDaoImpl;
import com.tmc.dao.impl.intair.IntairFareDaoImpl;
import com.tmc.dao.impl.intair.IntairOrderDaoImpl;
import com.tmc.entity.common.EthClient;
import com.tmc.entity.common.EthUser;
import com.tmc.entity.intair.IntairFare;
import com.tmc.entity.intair.IntairOrder;
import com.tmc.entity.intair.TripartitePolicy;
import com.tmc.service.baseinfo.AirlineServiceImpl;
import com.tmc.service.baseinfo.CityServiceImpl;
import com.tmc.util.DateUtil;
import com.tmc.util.ObjectUtil;


@Service
@Transactional
public class IntairFairServiceImpl {

	private Log logger = LogFactory.getLog(this.getClass());
	
	@Autowired
	private IntairFareDaoImpl fareDao;
	
	@Autowired
	private IntairOrderDaoImpl orderDao;
	
	@Autowired
	private UserDaoImpl userDao;
	
	@Autowired
	private EthClientDaoImpl clientDao;
	
	@Autowired
	private AirlineServiceImpl airlineService;
	
	@Autowired
	private CityServiceImpl cityService;
	
	@Autowired
	private TripartitePolicyDaoImpl tripartitePolicyDao;
	
	public Pagination<IntairFare> findByCon(ContextInfo context, IntairFare fare, int pageIndex, int pageSize){
		Pagination<IntairFare> result = fareDao.findByCon(context, fare, pageIndex,  pageSize);		
		setExtInfo(result);
		return result;	
	}
	
	public CommonResult save(ContextInfo context, IntairFare fare){
		CommonResult check = this.check(fare);
		if (!check.isSuccess()) {
			return check;
		}
		IntairFare dbFare = null;
		if (fare.getFareId() != null) {
			dbFare = fareDao.getById(fare.getFareId());
		}
		if (dbFare == null) {
			ObjectUtil.setBaseInfo(fare, context);
			fareDao.insert(fare);
		}else{
			try {
				ObjectUtil.copyProperties(fare, dbFare, new String[]{"createdBy", "creationDate", 
						"enabledFlag", "fareId" , "orderId" , "passengerId"});
			} catch (Exception e) {
				logger.error("拷贝对象错误", e);
			}
			ObjectUtil.updateBaseInfo(dbFare, context);
			fareDao.update(dbFare);
		}
		return CommonResult.makeSuccess();
	}
	
	public Pagination<IntairFare> findByFareAndOrder(ContextInfo context, IntairFare cond, IntairOrder order, int pageIndex, int pageSize){
		Pagination<IntairFare> result = fareDao.findByFareAndOrder(context, cond, order,  pageIndex,  pageSize);		
		if (result == null || result.getItems() == null || result.getItems().isEmpty()) {
			return result;
		}
		for(IntairFare fare : result.getItems()){
			if(fare.getOrderId() !=null){
				IntairOrder dborder = orderDao.getById(fare.getOrderId());
				if(order !=null){
					fare.setOrder(dborder);
					if(order.getClientId() !=null){
						EthClient client = clientDao.getById(order.getClientId());
						if(client != null){
							order.setClient(client);
						}
					}
				}
			}
			if(fare.getOperatorId() !=null){
				EthUser operator = userDao.getById(fare.getOperatorId());
				if(operator !=null){
					fare.setOperator(operator);
				}
			}
			setExtInfo(fare);
		}
		return result;	
	}
	
	@SuppressWarnings("rawtypes")
	public Pagination<Report> wangdian(ContextInfo context, IntairFare cond, IntairOrder order, int pageIndex, int pageSize, Map<String,String> groupByMap){
		Pagination<Map> result = fareDao.findByFareAndOrder(context, cond, order, pageIndex, pageSize, groupByMap);
		List<Report> reportItems= new ArrayList<Report>();
		Pagination<Report> page = new Pagination<Report>(result.getCurIndex(), result.getPageSize(), result.getRowsCount());
		if(result.getItems() == null || result.getItems().size() ==0){
			page.setItems(reportItems);
			return page;
		}
//		for (Map map : result.getItems()) {
//			Report report = mapToReport(map);
//			reportItems.add(report);
//		}
		reportItems = mapToReport(result);
		page.setItems(reportItems);
		return page;		
	}
	
	@SuppressWarnings("rawtypes")
	public Pagination<Report> findByFareAndOrder(ContextInfo context,
			IntairFare cond, IntairOrder order, int pageIndex, int pageSize,
			Map<String,String> groupByMap){
		Pagination<Map> result = fareDao.findByFareAndOrder(context, cond, order, pageIndex, pageSize, groupByMap);
		List<Report> reportItems= new ArrayList<Report>();
		Pagination<Report> page = new Pagination<Report>(result.getCurIndex(), result.getPageSize(), result.getRowsCount());
		if(result.getItems() == null || result.getItems().size() ==0){
			page.setItems(reportItems);
			return page;
		}
		reportItems = mapToReport(result);
		page.setItems(reportItems);
		return page;		
	}
	
	
	@SuppressWarnings("rawtypes")
	public Map<String,Object> findByCond(ContextInfo context, TripartiteReport cond){
		Map<String,String> groupByMap = new HashMap<>();
		List<TripartiteReport> reports= null;
		if(ObjectUtil.noText(cond.getAirline()) || !cond.getAirline().equals("CX")){
			List<Map> result = fareDao.findByCond(context, cond, groupByMap);
			reports = this.mapToTripartiteReport(result);
		}
		List<TripartiteReport> cZReports = null;
		
		if (ObjectUtil.noText(cond.getAirline()) || cond.getAirline().equals("CX")) {
			TripartiteReport tripartiteReport = null;
			try {
				tripartiteReport = ObjectUtil.makeTargetBean(cond, TripartiteReport.class);
				//ObjectUtil.copyProperties(cond, tripartiteReport);
			} catch (Exception e) {
				logger.error("拷贝对象出错！",e);
			}
			tripartiteReport.setAirline("CX");
			List<Map> result = fareDao.findByCond(context, tripartiteReport, groupByMap);
			cZReports = this.mapToTripartiteReport(result);
			//掉用按季度分组查询方法
			this.setCZReportsExt4Quarter(context, tripartiteReport, groupByMap, cZReports);
		}
		
		Map<String,Object> reportsMap = new HashMap<>();
		reportsMap.put("reports", reports);
		reportsMap.put("cZReports", cZReports);
		
		return reportsMap;
	}
	
	

	@SuppressWarnings("rawtypes")
	private void setCZReportsExt4Quarter(ContextInfo context, TripartiteReport cond, Map<String, String> groupByMap,
			List<TripartiteReport> cZReports) {
		//按季度分组查询
		groupByMap.put("quarter", "quarter");
		
		if (!(cZReports == null || cZReports.isEmpty())) {
			for (TripartiteReport report : cZReports) {
				cond.setClientId(report.getClientId());
				cond.setClientBusinessCode(report.getClientBusinessCode());
				List<Map> resultQuarter = fareDao.findByCond(context, cond, groupByMap);
				List<TripartiteReport> reportsQuarter = this.mapToTripartiteReport(resultQuarter);
				if (!(reportsQuarter == null || reportsQuarter.isEmpty())) {
					for (TripartiteReport reportQuarter : reportsQuarter) {
						if(reportQuarter.getQuarter() ==  null){
							continue;
						}
						if (reportQuarter.getQuarter().equals("1")) {
							report.setFirstQuqrterTotalAmount(reportQuarter.getTotalAmount());
							report.setFirstQuqrterTotalAmountStr(reportQuarter.getTotalAmountStr());
							report.setFirstQuqrterTotalRefundInvalidAmount(
									reportQuarter.getTotalRefundInvalidAmount());
							report.setFirstQuqrterTotalRefundInvalidAmountStr(
									reportQuarter.getTotalRefundInvalidAmountStr());
						}
						if (reportQuarter.getQuarter().equals("2")) {
							report.setSecondQuqrterTotalAmount(reportQuarter.getTotalAmount());
							report.setSecondQuqrterTotalAmountStr(reportQuarter.getTotalAmountStr());
							report.setSecondQuqrterTotalRefundInvalidAmount(
									reportQuarter.getTotalRefundInvalidAmount());
							report.setSecondQuqrterTotalRefundInvalidAmountStr(
									reportQuarter.getTotalRefundInvalidAmountStr());
						}
						if (reportQuarter.getQuarter().equals("3")) {
							report.setThirdQuqrterTotalAmount(reportQuarter.getTotalAmount());
							report.setThirdQuqrterTotalAmountStr(reportQuarter.getTotalAmountStr());
							report.setThirdQuqrterTotalRefundInvalidAmount(
									reportQuarter.getTotalRefundInvalidAmount());
							report.setThirdQuqrterTotalRefundInvalidAmountStr(
									reportQuarter.getTotalRefundInvalidAmountStr());
						}
						if (reportQuarter.getQuarter().equals("4")) {
							report.setFourthQuqrterTotalAmount(reportQuarter.getTotalAmount());
							report.setFourthQuqrterTotalAmountStr(reportQuarter.getTotalAmountStr());
							report.setFourthQuqrterTotalRefundInvalidAmount(
									reportQuarter.getTotalRefundInvalidAmount());
							report.setFourthQuqrterTotalRefundInvalidAmountStr(
									reportQuarter.getTotalRefundInvalidAmountStr());
						}
					}
				}
			}
		}
	}

	@SuppressWarnings("rawtypes")
	private List<TripartiteReport> mapToTripartiteReport(List<Map> result) {
		if(result == null || result.isEmpty()){
			return null;
		}
		List<TripartiteReport> reports = new ArrayList<>();
		for (Map map : result) {
			TripartiteReport report = this.mapToTripartiteReport(map);
			reports.add(report);
		}
		return reports;
	}
	
	@SuppressWarnings("rawtypes")
	private TripartiteReport mapToTripartiteReport(Map map) {
		if(map == null || map.isEmpty()){
			return null;
		}
		TripartiteReport report = new TripartiteReport();
		if(map.get("airline") != null && !map.get("airline").equals("")){
			report.setAirline((String) map.get("airline"));
			report.setAirlineName(airlineService.getNameByCode((String) map.get("airline")));
		}
		if (map.get("tripartitePolicyId") != null) {
			report.setTripartitePolicyId(((Integer) map.get("tripartitePolicyId")).longValue());
			//设置tripartitePolicy相关的信息
			this.setReportExt(report,report.getTripartitePolicyId());
		}
		if (map.get("quarter") != null && !map.get("quarter").equals("")) {
			report.setQuarter((String) map.get("quarter"));
		}
		
		if(map.get("totalAmount") !=null){
			report.setTotalAmount((Double)map.get("totalAmount"));
			report.setTotalAmountStr(big2((Double)report.getTotalAmount()));
		}else{
			report.setTotalAmount(0d);
			report.setTotalAmountStr(big2((Double)report.getTotalAmount()));
		}
		
		if(map.get("totalRefundPrice") !=null){
			report.setTotalRefundPrice(((BigDecimal)map.get("totalRefundPrice")).doubleValue());
			report.setTotalRefundPriceStr(big2((Double)report.getTotalRefundPrice()));
		}else{
			report.setTotalRefundPrice(0d);
			report.setTotalRefundPriceStr(big2((Double)report.getTotalRefundPrice()));
		}
		
		if(map.get("totalInvalidActualAmount") !=null){
			report.setTotalInvalidActualAmount(((BigDecimal)map.get("totalInvalidActualAmount")).doubleValue());
			report.setTotalInvalidActualAmountStr(big2((Double)report.getTotalInvalidActualAmount()));
		}else{
			report.setTotalInvalidActualAmount(0d);
			report.setTotalInvalidActualAmountStr(big2((Double)report.getTotalInvalidActualAmount()));
		}
		
		report.setCompletionRate(report.getTotalAmount() / report.getTask());// 完成率
		report.setDifference(report.getTotalAmount() - report.getTask());
		report.setDifferenceStr(big2((Double) report.getDifference()));
		report.setTotalRefundInvalidAmount(report.getTotalRefundPrice() + report.getTotalInvalidActualAmount());
		report.setTotalRefundInvalidAmountStr(big2((Double) report.getTotalRefundInvalidAmount()));// 总退,费金额;
		report.setActualCompletionRate(
				(report.getTotalAmount() - report.getTotalRefundInvalidAmount()) / report.getTask());// 实际完成率
		return report;
	}

	private void setReportExt(TripartiteReport report, Long tripartitePolicyId) {
		TripartitePolicy tripartitePolicy = tripartitePolicyDao.getById(report.getTripartitePolicyId());
		if(tripartitePolicy!=null){
			report.setProtocolDateEnd(tripartitePolicy.getProtocolDateEnd());
			report.setProtocolDateStart(tripartitePolicy.getProtocolDateStart());
			try {
				report.setProtocolDateStartStr(DateUtil.toStrDate(report.getProtocolDateStart(), "yyyy-MM-dd"));
				report.setProtocolDateEndStr(DateUtil.toStrDate(report.getProtocolDateEnd(), "yyyy-MM-dd"));
			} catch (ParseException e) {
				logger.error("时间转换出错！",e);
			}
			report.setTask(tripartitePolicy.getMinimumTask() * 10000);
			report.setTaskStr(big2((Double)report.getTask()));
			report.setClientName(tripartitePolicy.getClientName());
			report.setClientBusinessCode(tripartitePolicy.getClientBusinessCode());
		}
		
	}

	private void setExtInfo(Pagination<IntairFare> result) {
		if (result == null || result.getItems() == null || result.getItems().isEmpty()) {
			return;
		}
		for(IntairFare fare : result.getItems()){
			setExtInfo(fare);
		}
	}
	
	private void setExtInfo(IntairFare result){
		if (result == null) {
			return;
		}
		try {
			if(result.getOperatoringTime() != null && result.getOperatoringTime() !=0){
				result.setOperatoringTimeStr(DateUtil.toStrDate(result.getOperatoringTime(), "yyyy-MM-dd HH:mm:ss"));
			}	
		} catch (ParseException e) {
			logger.error("时间转换出错", e);
		}
		
	}
	

	@SuppressWarnings({ "rawtypes"})
	private List<Report> mapToReport( Pagination<Map> result){
		List<Report> list= new ArrayList<Report>();
		if (result == null || result.getItems() == null || result.getItems().isEmpty()) {
			return list;
		}
		
		for (Map map : result.getItems()) {
			Report report = mapToReport(map);
			list.add(report);
		}
		
		return list;	
	}
	
	@SuppressWarnings("rawtypes")
	private Report mapToReport(Map map){
		Report report = new Report();
		if(map==null || map.isEmpty()){
			return report;
		}
		//分组条件列
		if(map.get("eshopId") != null && ((BigInteger)map.get("eshopId")).longValue() != 0){
			report.setEshopId(((BigInteger)map.get("eshopId")).longValue());
		}
		if(map.get("airline") != null && !map.get("airline").equals("")){
			report.setAirline((String) map.get("airline"));
			report.setAirlineName(airlineService.getNameByCode((String) map.get("airline")));
		}
		if(ObjectUtil.hasText((String)map.get("departureCity"))){
			report.setDepartureCity((String)map.get("departureCity"));
			report.setDepartureCityName(cityService.getNameByCode(null, report.getDepartureCity()));
		}
		if(ObjectUtil.hasText((String)map.get("arrivalCity"))){
			report.setArrivalCity((String)map.get("arrivalCity"));
			report.setArrivalCityName(cityService.getNameByCode(null,report.getArrivalCity()));
		}
		if(map.get("bookOperatorId") != null && ((BigInteger)map.get("bookOperatorId")).longValue() != 0){
			report.setBookOperatorId(((BigInteger)map.get("bookOperatorId")).longValue());
			EthUser user = userDao.getById(report.getBookOperatorId());
			if(user != null){
				report.setBookOperatorName(user.getUserName());
				report.setBookOperatorCode(user.getUserCode());
			}		
		}
		if(map.get("drawOperatorId") != null && ((BigInteger)map.get("drawOperatorId")).longValue() != 0){
			report.setDrawOperatorId(((BigInteger)map.get("drawOperatorId")).longValue());
			EthUser user = userDao.getById(report.getDrawOperatorId());
			if(user != null){
				report.setDrawOperatorName(user.getUserName());
				report.setDrawOperatorCode(user.getUserCode());
			}		
		}
		
		if(map.get("departureDate") != null && ((BigInteger)map.get("departureDate")).longValue() !=0){
			report.setDepartureDate(((BigInteger)map.get("departureDate")).longValue());
			try {
				report.setDepartureDateStr(DateUtil.toStrDate(report.getDepartureDate(), "yy/MM"));
			} catch (ParseException e) {				
			}
		}
		if(map.get("operatoringTime") != null && ((BigInteger)map.get("operatoringTime")).longValue() !=0){
			report.setOperatoringTime(((BigInteger)map.get("operatoringTime")).longValue());
			try {
				report.setOperatoringTimeStr(DateUtil.toStrDate(report.getOperatoringTime(), "yy/MM"));
			} catch (ParseException e) {
			}
		}
		//普通列
		if(map.get("totalNormalTicket") !=null){
			report.setTotalNormalTicket(((BigInteger)map.get("totalNormalTicket")).longValue());
		}else{
			report.setTotalNormalTicket(0L);
		}
		if(map.get("totalRefundTicket") !=null){
			report.setTotalRefundTicket(((BigInteger)map.get("totalRefundTicket")).longValue());
		}else{
			report.setTotalRefundTicket(0L);
		}
		if(map.get("totalInvalidTicket") !=null){
			report.setTotalInvalidTicket(((BigInteger)map.get("totalInvalidTicket")).longValue());
		}else{
			report.setTotalInvalidTicket(0L);
		}
		if(map.get("totalAmount") !=null){
			report.setTotalAmount((Double)map.get("totalAmount"));
			report.setTotalAmountStr(big2((Double)report.getTotalAmount()));
		}else{
			report.setTotalAmount(0d);
			report.setTotalAmountStr(big2((Double)report.getTotalAmount()));
		}
		if(map.get("totalTicketPrice") != null){
			report.setTotalTicketPrice((Double)map.get("totalTicketPrice"));
    		report.setTotalTicketPriceStr(big2((Double)report.getTotalTicketPrice()));
    	}else{
			report.setTotalTicketPrice(0d);
			report.setTotalTicketPriceStr(big2((Double)report.getTotalTicketPrice()));
		}
		if(map.get("totalTax") != null){
			report.setTotalTax((Double)map.get("totalTax"));
    		report.setTotalTaxStr(big2((Double)report.getTotalTax()));
    	}else{
			report.setTotalTax(0d);
			report.setTotalTaxStr(big2((Double)report.getTotalTax()));
		}
		if(map.get("vendorTotalAmount") != null){
			report.setVendorTotalAmount((Double)map.get("vendorTotalAmount"));
    		report.setVendorTotalAmountStr(big2((Double)report.getVendorTotalAmount()));
    	}else{
			report.setVendorTotalAmount(0d);
			report.setVendorTotalAmountStr(big2((Double)report.getVendorTotalAmount()));
		}
		if(map.get("totalRefundPrice") != null){
			report.setTotalRefundPrice(((BigDecimal)map.get("totalRefundPrice")).doubleValue());
    		report.setTotalRefundPriceStr(big2((Double)report.getTotalRefundPrice()));
    	}else{
			report.setTotalRefundPrice(0d);
			report.setTotalRefundPriceStr(big2((Double)report.getTotalRefundPrice()));
		}
		if(map.get("totalVendorRefundPrice") != null){
			report.setTotalVendorRefundPrice(((BigDecimal)map.get("totalVendorRefundPrice")).doubleValue());
    		report.setTotalVendorRefundPriceStr(big2((Double)report.getTotalVendorRefundPrice()));
    	}else{
			report.setTotalVendorRefundPrice(0d);
			report.setTotalVendorRefundPriceStr(big2((Double)report.getTotalVendorRefundPrice()));
		}
		if(map.get("totalInvalidActualAmount") != null){
			report.setTotalInvalidActualAmount(((BigDecimal)map.get("totalInvalidActualAmount")).doubleValue());
    		report.setTotalInvalidActualAmountStr(big2((Double)report.getTotalInvalidActualAmount()));
    	}else{
			report.setTotalInvalidActualAmount(0d);
			report.setTotalInvalidActualAmountStr(big2((Double)report.getTotalInvalidActualAmount()));
		}
		if(map.get("totalAbandonPrice") != null){
			report.setTotalAbandonPrice(((BigDecimal)map.get("totalAbandonPrice")).doubleValue());
    		report.setTotalAbandonPriceStr(big2((Double)report.getTotalAbandonPrice()));
    	}else{
			report.setTotalAbandonPrice(0d);
			report.setTotalAbandonPriceStr(big2((Double)report.getTotalAbandonPrice()));
		}
		
		report.setTotalTicket(report.getTotalNormalTicket()+report.getTotalRefundTicket()+report.getTotalInvalidTicket());
		report.setTotalRefundActualAmount(report.getTotalRefundPrice()+report.getTotalVendorRefundPrice());
		report.setTotalRefundActualAmountStr(big2((Double)report.getTotalRefundActualAmount()));
		
		return report;	
	}
	
	public Report sumReport(List<Report> reports){
		if(reports == null || reports.size() == 0 || reports.isEmpty()){
			return null;
		}
		Report report = new Report();
		report.setTotalNormalTicket(0L);
		report.setTotalRefundTicket(0L);
		report.setTotalInvalidTicket(0L);
		report.setTotalAmount(0D);
		report.setVendorTotalAmount(0D);
		report.setTotalTax(0D);
		report.setTotalRefundPrice(0D);
		report.setTotalRefundActualAmount(0D);
		report.setTotalAbandonPrice(0D);
		report.setTotalInvalidActualAmount(0D);
		for (Report rep : reports) {
			report.setTotalNormalTicket(report.getTotalNormalTicket()+rep.getTotalNormalTicket());
			report.setTotalRefundTicket(report.getTotalRefundTicket()+rep.getTotalRefundTicket());
			report.setTotalInvalidTicket(report.getTotalInvalidTicket()+rep.getTotalInvalidTicket());
			report.setTotalAmount(report.getTotalAmount()+rep.getTotalAmount());
			report.setVendorTotalAmount(report.getVendorTotalAmount()+rep.getVendorTotalAmount());
			report.setTotalTax(report.getTotalTax()+rep.getTotalTax());
			report.setTotalRefundPrice(report.getTotalRefundPrice()+rep.getTotalRefundPrice());
			report.setTotalRefundActualAmount(report.getTotalRefundActualAmount()+rep.getTotalRefundActualAmount());
			report.setTotalAbandonPrice(report.getTotalAbandonPrice()+rep.getTotalAbandonPrice());
			report.setTotalInvalidActualAmount(report.getTotalInvalidActualAmount()+rep.getTotalInvalidActualAmount());
		}		
		report.setTotalAmountStr(big2(report.getTotalAmount()));
		report.setVendorTotalAmountStr(big2(report.getVendorTotalAmount()));
		report.setTotalTaxStr(big2(report.getTotalTax()));
		report.setTotalRefundPriceStr(big2(report.getTotalRefundPrice()));
		report.setTotalRefundActualAmountStr(big2(report.getTotalRefundActualAmount()));
		report.setTotalAbandonPriceStr(big2(report.getTotalAbandonPrice()));
		report.setTotalInvalidActualAmountStr(big2(report.getTotalInvalidActualAmount()));		
		return report;		
	} 
	
	private static String big2(double d) {
        BigDecimal d1 = new BigDecimal(Double.toString(d));
        BigDecimal d2 = new BigDecimal(Integer.toString(1)); 
        // 四舍五入,保留2位小数
        return d1.divide(d2,2,BigDecimal.ROUND_HALF_UP).toString();
    }
	
	private CommonResult check(IntairFare fare) {
		
		if(fare.getTax() != null){
			return CommonResult.makeFail("税费不能为空");
		}
		if(fare.getTicketPrice() != null){
			return CommonResult.makeFail("公布运价不能为空");
		}
		if(fare.getTicketPrice() != null){
			return CommonResult.makeFail("应收总价不能为空");
		}
		return null;
	}
}
